package com.budwk.app.enterprise.services.impl;

import com.budwk.app.enterprise.models.ProfitTaxLabor;
import com.budwk.app.enterprise.services.ProfitTaxLaborService;
import com.budwk.starter.common.page.PageUtil;
import com.budwk.starter.common.page.Pagination;
import com.budwk.starter.database.service.BaseServiceImpl;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings;

@IocBean(args = {"refer:dao"})
public class ProfitTaxLaborServiceImpl extends BaseServiceImpl<ProfitTaxLabor> implements ProfitTaxLaborService {
    public ProfitTaxLaborServiceImpl(Dao dao) {
        super(dao);
    }

    @Override
    public Pagination listByPage(ProfitTaxLabor taxLabor) {
        Cnd cnd = Cnd.NEW();
        if (Strings.isNotBlank(taxLabor.getPageOrderName()) && Strings.isNotBlank(taxLabor.getPageOrderBy())) {
            cnd.orderBy(taxLabor.getPageOrderName(), PageUtil.getOrder(taxLabor.getPageOrderBy()));
        }
        return this.listPage(taxLabor.getPageNo(), taxLabor.getPageSize(), cnd);
    }
}
